package org.spring.learn.demo.annotation.injections.autowired;

import org.junit.Test;
import org.spring.learn.project.controller.MyController;
import org.spring.learn.project.dao.MyDao;
import org.spring.learn.project.entity.Bird;
import org.spring.learn.project.service.MyService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.Environment;

public class MyTest {

    @Test
    public void test() {

        ApplicationContext app = new AnnotationConfigApplicationContext(MyConfig.class);
        System.out.println("IoC容器创建");
        Object myController =  app.getBean("myController");
        System.out.println(myController);


        MyService service = app.getBean(MyService.class);
        service.print();
        MyDao dao = app.getBean(MyDao.class);
        System.out.println(dao);

    }
}
